<?php

/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
$title=($this->context->curUserIsAdmin)?'查看或修改会员信息':'查看个人信息';

  $this->title = $title;
  $this->params['breadcrumbs'][] = $this->title;
  ?>
  <!-- page title -->
  <div class="page-title">
    <div>
      <h1><i class="fa fa-users"></i> <?=$title?></h1>
      <ul class="breadcrumb side">
        <li><i class="fa fa-home fa-lg"></i></li>
        <?php
        if($this->context->curUserIsAdmin){
         ?>
        <li><a href="#">会员管理</a></li>
        <li><a href="<?=Url::toRoute('site/users')?>">查看和修改会员信息</a></li>
        <li class="active"><a href="#"><?=$model->name?></a></li>
        <?php
        }else{
         ?>
         <li class="active"><a href="#">查看个人信息</a></li>
        <?php
          }
         ?>
      </ul>
    </div>

  </div>
  <!-- page title end-->

  <!-- page body start -->
  <div class="card">
  <?php $form = ActiveForm::begin(['options'=>['class'=>'form-horizontal']]); ?>

  <?php
    if(isset($tip)&&$tip===true){
      if($model->hasErrors()){
  ?>
        <div class="alert alert-danger" role="alert">
          <?php
              foreach($model->getErrors("") as $key=>$value){
                echo $value."<br>";
              }
          ?>
        </div>
  <?php
      }else{
  ?>
        <div class="alert alert-success" role="alert">修改会员信息成功！</div>
  <?php
      }
    }
  ?>
  <?=Html::activeHiddenInput($model,'id')?>
  <?=$form->field($model, 'name',[
    'labelOptions'=>[
      'class'=>'control-label col-sm-2'
    ],
    'template'=>'{label}<div class="col-sm-10">{input}{hint}{error}</div>',
    'inputOptions'=>[
      'class' => 'form-control',
      'readonly'=>'true'
    ]
    ])->label('用  户  名')?>
  <?=$form->field($model, 'realname',[
    'labelOptions'=>[
      'class'=>'control-label col-sm-2'
    ],
    'template'=>'{label}<div class="col-sm-10">{input}{hint}{error}</div>',
    'inputOptions'=>[
      'class' => 'form-control',
      'readonly'=>'true'
    ]
    ])?>
  <?=$form->field($model, 'sfzid',[
      'labelOptions'=>[
        'class'=>'control-label col-sm-2'
      ],
      'template'=>'{label}<div class="col-sm-10">{input}{hint}{error}</div>',
      'inputOptions'=>[
        'class' => 'form-control',
        'readonly'=>'true'
      ]
      ])?>
  <?=$form->field($model, 'bankcardid',[
        'labelOptions'=>[
          'class'=>'control-label col-sm-2'
        ],
        'template'=>'{label}<div class="col-sm-10">{input}{hint}{error}</div>',
        'inputOptions'=>[
          'class' => 'form-control',
          'readonly'=>'true'
        ]
        ])?>
  <?=$form->field($model, 'opencardbank',[
          'labelOptions'=>[
            'class'=>'control-label col-sm-2'
          ],
          'template'=>'{label}<div class="col-sm-10">{input}{hint}{error}</div>',
          'inputOptions'=>[
            'class' => 'form-control',
            'readonly'=>'true'
          ]
          ])?>
  <?=$form->field($model, 'alipay',[
    'labelOptions'=>[
      'class'=>'control-label col-sm-2'
    ],
    'template'=>'{label}<div class="col-sm-10">{input}{hint}{error}</div>',
    'inputOptions'=>[
      'class' => 'form-control',
      'readonly'=>'true'
    ]
    ])?>


  <!--输入-->
  <?=$form->field($model, 'phone',[
    'labelOptions'=>[
      'class'=>'control-label col-sm-2'
    ],
    'template'=>'{label}<div class="col-sm-10">{input}{hint}{error}</div>',
    'inputOptions'=>[
      'class' => 'form-control',
      'readonly'=>'true'
    ]
    ])?>
<?php
  if($this->context->curUserIsAdmin){

?>
  <div class='row'>
    <div class='col-sm-2'>
    </div>
    <div class='col-sm-10'>

      <button type="submit" class="btn btn-warning" >提交</button>

      <a id='goto_edit' class="btn btn-warning" style='cursor:pointer'><i class="fa fa-lg fa-edit"></i> 进入修改模式</a>

    </div>
  </div>
  <?php
  }
  ?>
  <?php ActiveForm::end(); ?>
  </div>
  <!-- page body end-->
</div>

<?php
if($this->context->curUserIsAdmin){
$this->beginBlock('edit-js')
?>

  $('button[type=submit]').hide();
  //审核提现
  $('#goto_edit').click(function(){
    $('#updatememberform-name').prop('readonly',false);

    //'template'=>'{label}<div class="col-sm-10">{input}{hint}{error}</div>',
    $('#updatememberform-realname').prop('readonly',false);
    $('#updatememberform-sfzid').prop('readonly',false);
    $('#updatememberform-bankcardid').prop('readonly',false);
    $('#updatememberform-opencardbank').prop('readonly',false);
    $('#updatememberform-alipay').prop('readonly',false);
    $('#updatememberform-phone').prop('readonly',false);
    $('.help-block').show();
    $('button[type=submit]').show();
    $('#goto_edit').hide();
  });



<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['edit-js'],\yii\web\View::POS_END);
}
?>
